<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="/fuman/js/product.js"></script>
<script>
	function showimages(id,t,s)
	{
		$.post("/externalBuy/ajaxbutton", {"op": "showImages","id":id},
				function(data){
					if(data)
					{
						var tmp="<div class=upload_preview>";
						for(var i=0;i<data.length;i++)
						{
							if(s==1)
							{
								var dels= "<div class=\"delnocss\" style='right:-15px;'><a href=\"#\" title=\"删除图片\"><img src=\"/fuman/images/no.gif\" onclick=\"delone("+data[i].id+",'externalbuy',0)\"></a></div>";
							}else{
								var dels="";
							}
							tmp+=" <div style='border:1px;width:90px;  margin: 1em;float: left;position: relative;'><a href="+data[i].images_url+" target=_thank><img src='"+data[i].thumb_url+"' style=\"width:expression(this.width > 85 ? 85px : this.width)\"></a>"+dels+"</div>";
						}
						$("#uidvalue").val(id);
						tmp+="</div>";
						$("#showimages").html(tmp);
					}

				},"json");
		$("#MergeProductID").val(id);
		if(t==1)
		{
			$("#zyupload").hide();
		}else{
			$("#zyupload").show();
		}
		$('#showimagesform').modal('show');

	}
	function changestatus(id,status,msg,sku)
	{
		//status  99 已完成 1 样品采购 2 确认开发(待出图） 3 出图（已出图状态）  4 作废(终止开发) 5.删除  确认开发是弹出框
		if(status == 99){
			$("#buyId").val(id);
			$("#skuId").val(sku);
			$("#excelorderform").show();
		}else{
			if(confirm(msg))
			{
				$.post("/externalBuy/ajaxbutton", {"op": "changestatus","id":id,"status":status},
						function(data){
								window.location.reload();
						},"json");
			}
		}
	}
	function showthesample(id,status)
	{
		$.post("/product/ajaxbutton", {"op": "getoneproductdata","id":id},
				function(data){
					if(data)
					{
						$("#versiondivision").find("option[value="+data.versiondivision+"]").attr("selected",true);
						if(data.wages=='0.00')data.wages='';
						if(data.samplecosprice=='0.00')data.samplecosprice='';
						if(data.bulkprice=='0.00')data.bulkprice='';
						$("#wages").val(data.wages);
						$("#cosprice").val(data.samplecosprice);
						$("#qualitymemo").val(data.qualitymemo);
						$("#bulkprice").val(data.bulkprice);
						$("#ck").val(data.ck);
						$("#samplememo").val(data.samplememo);
						var arr=new String();
						arr = data.bodystandard.split("+");
						for(var i=0;i<arr.length;i++)
						{
							$("#bodystandard"+arr[i]).attr("checked","checked");
						}
						if(data.sampleuser){
							$("#sampleuser").html("<tr><th>出样人：</th><td>"+data.sampleuser+"</td></tr>");
						}

					}
				},"json");
		$("#MProductID").val(id);
		$("#MProductstatus").val(status);
		$('#showthesampleform').modal('show');
	}
	//确认开发
	function doSureDevelop() {
		var weight = $("#weight").val();
		if(!weight){
			alert("重量不能为空");return false;
		}
		var goodstypeID = $("#goodstypeID").val();
		if(!goodstypeID){
			alert("商品属性不能为空");return false;
		}
		var length = $("#length").val();
		var width  = $("#width").val();
		var heigth = $("#heigth").val();
		if(!length){
			alert("长宽高不能为空，若不知道具体尺寸，默认长宽高可以填写35 25 8");return false;
		}
		if(!width){
			alert("长宽高不能为空，若不知道具体尺寸，默认长宽高可以填写35 25 8");return false;
		}
		if(!heigth){
			alert("长宽高不能为空，若不知道具体尺寸，默认长宽高可以填写35 25 8");return false;
		}

		$("#excelattributeform").submit();
		$("#excelorderform").hide();

	}
	/******全站ajax button****/
	function delone(id,t,v)
	{
		if(v == 1){
			var message = "确定移除所有图片？";
		}else{
			var message = "确定移除?"
		}
		if(confirm(message))
		{
			$.post("/externalBuy/ajaxbutton", {"op": "delone","id":id,"st":t,"delflag":v},
					function(data){
						if(data.txt==200)
						{
							document.location.href = data.url;
							return;
						}

						if(data.txt==201)
						{
							alert(data.text);
							return ;
						}

						return;
					},"json");
		}
	}
	function importExcel(flag) {
		if(flag == 1){
			$("#excelimportform").show();
		}
		if(flag==2){
			$("#importattributeform").submit();
			$("#excelimportform").hide();
		}
	}
	function doFinish(id,linkUrl,flag) {
		if(flag == 1){
			$("#external_id").val(id);
			if(linkUrl){
				$("#linkUrl").val(linkUrl);
			}
			$("#dofinishform").show();
		}
		if(flag==2){
			var external_id = $("#external_id").val();
			var linkUrl  = $.trim($("#linkUrl").val());
			if(linkUrl){
			}else{
				alert("链接不能为空");return false;
			}
			$.post("/externalBuy/ajaxbutton", {"op": "doFinish","external_id":external_id,"linkUrl":linkUrl},
					function(data){
						if(data == 200)
						{
							alert("成功!");
							window.location.reload();
						}
					},"text");
		}
	}
</script>
<title>外采购列表</title>
<body class="withvernav">
<div class="bodywrapper">
{{include file='/public/leftmenu.tpl'}}
<div class="centercontent">
<div class="pageheader notab">
  <h1 class="pagetitle">外采购商品列表</h1>
  <span class="pagedesc"> 开款规定： 商品有多个款式时，<font color="#FF0000">开款不超过五个尺码，</font> 多个颜色多个尺码时，只开一个常用颜色不超过五个尺码,后续根据销售情况，再考虑是否追加颜色或尺码。 <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库存库位：培育期商品，采购质检入临时仓位由开发人员自己完成，
  商品正常销售后，必须找仓库设置正式仓位，交由公司采购人员采购。质检入库需仓库人员完成，禁止开发人员自己质检入库。 <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;详细说明请下载《<font color="red">外采商品开发说明（2018年1版）</font>》 <a href="/fuman/Exceltemplate/Manual_2018.docx" target="_blank">点击下载</a> </span>
  <div class="menulist">
    <ul class="profile_summary">
      {{if $managers || in_array('250',$showpower)}}
      <li><a href="/externalBuy/addNewproduct"><span>添加外采购商品</span></a></li>
      {{/if}}
    </ul>
  </div>
</div>
<!--pageheader-->

<div id="contentwrapper" class="contentwrapper">
  <div id="basicform" class="subcontent">
    <div>
      <div style="float:left">
        <button class="stdbtn btn_blue" onClick="importExcel(1);return false;">导入excel</button>
        &nbsp;&nbsp;&nbsp;
        {{if $managers || in_array('264',$showpower)}}
        <button class="stdbtn btn_yellow" onClick="updDeveloper(0,1,0,0);return false;">更改维护者</button>
        &nbsp;&nbsp;&nbsp;
        {{/if}}
        <button class="stdbtn btn_lime" onClick="doRecommend(0);return false;">推荐商品</button>
        &nbsp;&nbsp;&nbsp; </div>
      <!--搜索栏-->
      <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
    </div>
    <form class="stdform stdform2" method="get" id="search" action="/externalBuy/extBuyList">
      <input type='hidden' name='if_csv' id='if_csv'>
      <div class="tableoptions">
        <select name="ty" id="searchtype" class="selection" style="width:100px;">
          <option value="1" {{if $ty==1}} selected{{/if}}>创建时间</option>
          <option value="2" {{if $ty==2}} selected{{/if}}>完成时间</option>
        </select>
        <input type="text" name="starttime" value="{{$starttime}} "
						       onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker"/>
        -
        <input
								type="text" name="endtime" value="{{$endtime}} "
								onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker"/>
        关键词:
        <input type="text" name="other" id="other" class="width300" value="{{$other}}"
						            placeholder="商品编号(多个以逗号隔开)"/>
        &nbsp;
        状态:
        <select class="selectCss2" name="status" id="status">
          <option value="">请选择</option>
          <option value="1" {{if $status==1}} selected{{/if}}>样品采购</option>
          <option value="2" {{if $status==2}} selected{{/if}}>待出图</option>
          <option value="3" {{if $status==3}} selected{{/if}}>已出图</option>
          <option value="4" {{if $status==4}} selected{{/if}}>终止开发</option>
          <option value="99" {{if $status==99}} selected{{/if}}>已完成</option>
        </select>
        <!--
						开发人员: <input type="text" name="createName" id="createName" class="width200" value="{{$createName}}" placeholder="请输入开发人员"/>
						--> 
        开发人员:
        <select name="createName" id="createName" class="selection select2_group" style="width:100px;" >
          <option value="0">请选择</option>
          
							{{foreach from=$searchuserlist item=res key=key}}
							
          <option value="{{$res}}"  {{if $res eq $createName}}selected{{/if}}>{{$res}}</option>
          
							{{/foreach}}
						
        </select>
        &nbsp;
        受推荐人:
        <select name="recommender" id="recommender" class="selection select2_group" style="width:100px;" >
          <option value="0">请选择</option>
          
							{{foreach from=$receiverlist item=res key=key}}
								
          <option value="{{$res.id}}"  {{if $res.id eq $recommender}}selected{{/if}}>{{$res.name}}</option>
          
							{{/foreach}}
						
        </select>
        &nbsp;
        <button class="btn btn_orange btn_search radius50">Search</button>
      </div>
    </form>
    <!--搜索栏结束-->
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
      <thead>
        <tr class="lbbt">
          <td width="3%" bgcolor="#FEFFF1"><a onClick="allSelect('ppid[]')">全选</a></td>
          <td width="6%" bgcolor="#FEFFF1">商品编号</td>
          <!--
						<td width="10%" bgcolor="#FEFFF1">SKU</td>
						-->
          <td width="5%" bgcolor="#FEFFF1">图片</td>
          <td width="15%" bgcolor="#FEFFF1">商品名称<br/>
            英文名称</td>
          <td width="5%" bgcolor="#FEFFF1">成本价</td>
          <td width="5%" bgcolor="#FEFFF1">状态</td>
          <td width="6%" bgcolor="#FEFFF1">开发人员</td>
          <td width="9%" bgcolor="#FEFFF1">创建时间</td>
          <td width="6%" bgcolor="#FEFFF1">维护人员</td>
          <!--
						<td width="6%" bgcolor="#FEFFF1">尺码信息</td>
						<td width="6%" bgcolor="#FEFFF1">面料信息</td>
						-->
          <td width="10%" bgcolor="#FEFFF1">备注信息</td>
          <td width="5%" bgcolor="#FEFFF1">样本链接</td>
          <td width="10%" bgcolor="#FEFFF1">受推荐人</td>
          <td  bgcolor="#FEFFF1">操作</td>
        </tr>
      </thead>
      {{foreach from=$goodslist item=li key=key}}
      <tbody id="bdetail{{$detail.p_parent_id}}">
        <!-- 超级管理员 创建人  已完成   -->
        <tr>
          <td><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$li.id}}" onClick="showallchangsmod()"/></td>
          <td valign="middle" style="position:relative;"> {{if $li.status eq 99}}
            {{if $li.sales1  gte 4}} <a href="/product/productlist?other={{$li.sku}}" target="_blank" style="color:red;" title="若为红色标记，说明7天内销售大于等于4件商品">{{$li.sku}}</a> {{else}} <a href="/product/productlist?other={{$li.sku}}" target="_blank">{{$li.sku}}</a> {{/if}}
            {{else}}
            {{$li.sku}}
            {{/if}} </td>
          <!--
						<td valign="middle" style="position:relative;">
							{{foreach from=$li.subsku item=result key=k}}
								{{$result}}<br/>
							{{/foreach}}
						</td>
						-->
          <td valign="middle"> {{if $li.mod==1}} <a href="javascript:void(0)" onClick="showimages({{$li.id}},1,1)"><img src="{{$li.images}}" width="50"></a> {{else}} <a href="javascript:void(0)" onClick="showimages({{$li.id}},1,0)"><img src="{{$li.images}}" width="50"></a> {{/if}} </td>
          <td><div class="lbcp"> {{if $li.linkUrl}}<a href="{{$li.linkUrl}}" target="_blank"><img src="/fuman/images/icons/attachment.png"></a> {{/if}} {{$li.p_parent_name}}<br>
              {{$li.en_goods_name}} 
            </div></td>
          <td valign="middle">{{$li.p_costprice}}</td>
          <td class="cz"> {{if $li.status eq 1}}
            样品采购
            {{/if}}
            {{if $li.status eq 2}}
            待出图
            {{/if}}
            {{if $li.status eq 3}}
            已出图
            {{/if}}
            {{if $li.status eq 4}}
            终止开发
            {{/if}}
            {{if $li.status eq 99}}
            已完成
            {{/if}}
             </td>
          <td class="cz">{{$li.developer}}</td>
          <td class="cz">{{$li.createTime}}</td>
          <td class="cz">{{$li.protector}}</td>
          <!--
						<td class="cz">
							<element title="{{$li.sizeinfo}}">{{$li.sizeinfo}}</element>
						</td>
						<td class="cz"><element title="{{$li.fabricinfo}}">{{$li.fabricinfo}}</element></td>
						-->
          <td class="cz"><element title="{{$li.memo}}">{{$li.memo}}</element></td>
          <td class="cz"> {{if $li.mod==1}} <a href="javascript:void(0)" onClick="showimages({{$li.id}},0,1)">样本图</a> {{else}} <a href="javascript:void(0)" onClick="showimages({{$li.id}},0,0)">样本图</a> {{/if}} </td>
          <td class="cz"> {{foreach from=$li.receivers item=res key=key}}
            {{if $res.flag == 1}} <a href="{{$res.address}}" style="color:red;" target="_blank">{{$arr_receiver[$res.userid]}}&nbsp;</a> {{elseif $res.flag == 2}} <a href="javascript:void(0);"> <s>{{$arr_receiver[$res.userid]}}</s> <span id="tip_info">取消原因：{{$res.address}}</span></a> {{else}}
            {{$arr_receiver[$res.userid]}}&nbsp;
            {{/if}}
            {{/foreach}} </td>
          <td class="cz"> 
            {{if $userclassidst eq 8 || $userclassidst eq 9}} 
           		 {{if $li.status eq 2}} <a href="javascript:void(0)" onClick="changestatus({{$li.id}},3,'你确认该商品已出图？')">出图</a> {{/if}}
            {{/if}}
            {{if $managers || $li.protector eq $username}}
            {{if $li.status eq 1 || $li.status eq 2 || $li.status eq 3}}
           	 	<a href="/externalBuy/addNewproduct?id={{$li.id}}">编辑</a> &nbsp;|&nbsp;
           		<a href="javascript:void(0)" onClick="changestatus({{$li.id}},5,'你确定删除该商品?')">删除</a>&nbsp;|&nbsp;
            {{/if}}
            <a href="/externalBuy/addNewproduct?id={{$li.id}}&show=1" target="_blank">查看</a> &nbsp;|&nbsp;
            
            {{if $li.status eq 1}} 
            	 <a href="javascript:void(0)" onClick="changestatus({{$li.id}},2,'你确认开发该商品？')">确认开发</a> 
                 &nbsp;|&nbsp;
            {{/if}}
            {{if $li.status eq 1 || $li.status eq 2 || $li.status eq 3}} <a href="javascript:void(0)" onClick="changestatus({{$li.id}},4,'你确认终止开发该商品?');return false;"> 终止开发</a> {{/if}}
            
            
            {{if $li.status eq 2}}&nbsp;|&nbsp;<a href="javascript:void(0)" onClick="changestatus({{$li.id}},3,'你确认该商品已出图？')">出图</a> {{/if}}
           
            {{if $li.status eq 3}}&nbsp;|&nbsp;<a href="javascript:void(0)" onClick="changestatus({{$li.id}},99,'你确认完成该流程？','{{$li.sku}}')">完成</a> {{/if}}
            
           
            {{if $li.status eq 99}}
            <a href="javascript:void(0)" onClick="doFinish({{$li.id}},'{{$li.linkUrl}}',1)">参考链接</a>
            &nbsp;|&nbsp;<a href="javascript:void(0)" onClick="changestatus({{$li.id}},4,'你确认终止开发该商品?');return false;"> 终止开发</a>
            {{if $li.showreport}}
            &nbsp;|&nbsp;<a href="javascript:void(0)" onClick="showreport('{{$li.sku}}')">销售数据</a>{{/if}}
             {{/if}}
            
            {{/if}} 
            {{if $li.status eq 99 && in_array($li.protector,$arr_employee) && $li.reverseflag eq 1}}
            {{if $li.goods_code}}
            {{else}} <a href="/product/addNewprodct?sku={{$li.sku}}" target="_blank">转正开发</a> 
           		 <!--
					<a href="javascript:void(0);" onClick="reverseDeveloper('{{$li.sku}}');"> <button class="stdbtn">转正开发</button></a>
				--> 
            {{/if}}
            {{/if}} </td>
        </tr>
      {{/foreach}}
    </table>
    <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
  </div>
</div>



<!-- 模态框（Modal） 文员出样-->
<form action="/product/ajaxbutton?op=saveProductsample"  method="post" name="utimgtform" id="utimgtform" >
  <input type="hidden" name="MProductID" id="MProductID">
  <input type="hidden" name="MProductstatus" id="MProductstatus">
  <div class="modal fade" id="showthesampleform" tabindex="-1" role="dialog" aria-labelledby="sshowthesampleform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true">× </button>
          <h4 class="modal-title" id="sshowthesampleform">出样信息填写 </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tbody>
            <span id="sampleuser"></span>
            <tr>
              <th>打版师 </th>
              <td align="left" width="70%"><select class="selection" id="versiondivision" name="versiondivision">
                  <option value="">--请选择--</option>
                  
											{{foreach from=$versiondivision item=li key=key}}
											
                  <option value="{{$li.id}}">{{$li.name}}</option>
                  
											{{/foreach}}
										
                </select>
                <span id="versiondivisionerr"></span></td>
            </tr>
            <tr>
              <th>工价 </th>
              <td height="25"><input type="text" name="wages" id="wages"  onKeyUp="this.value=this.value.replace(/[^\d.]/g,'');" class="width100">
                <span id="wageserr"></span></td>
            </tr>
            <tr>
              <th>成本价 </th>
              <td align="left"><input type="text" name="cosprice" id="cosprice"  class="width100" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'');">
                <span id="cospriceerr"></span></td>
            </tr>
            <tr>
              <th>批量价 </th>
              <td align="left"><input type="text" name="bulkprice" id="bulkprice"  class="width100" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'');">
                <span id="bulkpriceerr"></span></td>
            </tr>
            <tr>
              <th>主件质检信息 </th>
              <td align="left"> {{foreach from=$bodystandard item=res key=key}}
                &nbsp;&nbsp;
                <input name="bodystandard[]" id="bodystandard{{$res}}" type="checkbox" value="{{$res}}">
                &nbsp;{{$res}}
                {{/foreach}} <span id="bodystandarderr"></span></td>
            </tr>
            <tr>
              <th>配件质检信息 </th>
              <td align="left"><textarea name="qualitymemo" id="qualitymemo" cols="5" rows="5"></textarea>
                <span id="qualitymemoerr"></span></td>
            </tr>
            <tr>
              <th>面料信息 </th>
              <td align="left"><textarea name="ck" id="ck" cols="5" rows="5"></textarea>
                <span id="ckerr"></span></td>
            </tr>
            <tr>
              <th>备注信息 </th>
              <td align="left"><textarea name="memo" id="samplememo" cols="5" rows="5"></textarea></td>
            </tr>
              </tbody>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default"
								        data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="savechuyang()"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- 模态框（Modal）出样框 --> 

<!-- 导单订单EXCEL--> 
<!-- 模态框（Modal）交运内容 -->
<form action="/externalBuy/ajaxbutton" enctype="multipart/form-data" method="post" name="excelattributeform" id="excelattributeform" >
  <div class="modal fade" id="excelorderform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true" style="padding-top:160px;" >
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true" onClick="javascript:$('#excelorderform').hide();location.reload();">× </button>
          <h4 class="modal-title"><span id="order_mailnott">确认完成</span></h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0" >
            <thead>
              <tr>
                <td width="45">重量： </td>
                <td align="left" colspan="8"><input type="hidden" value="{{$buyId}}" name="buyId" id="buyId">
                  <input type="hidden" value="{{$skuId}}" name="skuId" id="skuId">
                  <input type="hidden" value="99" name="status" id="status">
                  <input type="hidden" value="changestatus" name="op" id="op">
                  重量：
                  <input  type="text" name="weight" id="weight" value="" style="width: 60px;" placeholder="请输入重量"/>
                  克&nbsp;<span style="color:red;">(必填)</span></td>
              </tr>
              <tr>
                <td width="45">长宽高:</td>
                <td colspan="8"> 长度：
                  <input  type="text" name="length" id="length" value="" style="width: 60px;" placeholder="请输入长度"/>
                  CM &nbsp;
                  宽度：
                  <input  type="text" name="width" id="width" value="" style="width: 60px;" placeholder="请输入宽度"/>
                  CM &nbsp;
                  高度：
                  <input  type="text" name="heigth" id="heigth" value="" style="width: 60px;" placeholder="请输入高"/>
                  CM &nbsp; </td>
              </tr>
              <tr>
                <td width="45">商品</td>
                <td colspan="3"> 属性：
                  <select name="goodstypeID" id="goodstypeID" class="selection" style="width:100px;" onChange="javascript:$('tr').remove('.italic');" required>
                    <option value="">请选择</option>
                    
											{{foreach from=$attribute item=res key=key}}
												
                    <option value="{{$res.cat_id}}">{{$res.cat_name}}</option>
                    
											{{/foreach}}
										
                  </select></td>
              </tr>
              <tr>
                <td colspan="12" class="head1" style="font-size:18px;">添加子类商品 &nbsp;&nbsp;&nbsp; <span style="margin-top:10px"> <a href="javascript:void(0)"  onClick="showinput()"><img src="/fuman/images/add.png"></a> &nbsp;&nbsp;<span style='color:red;font-size:12px;'>(不是必填项*)</span> </span></td>
              </tr>
            </thead>
            <tbody id="input1">
            </tbody>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal" style="display:none"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="doSureDevelop()">确认完成</button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- /.modal --> 
<!-- 导单订单EXCEL--> 
<!-- 模态框（Modal）交运内容 -->
<form action="/externalBuy/importExcel" enctype="multipart/form-data" method="post" name="importattributeform" id="importattributeform" target="_blank">
  <div class="modal fade" id="excelimportform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true" style="margin-top: 60px;padding-top:60px;">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true" onClick="javascript:$('#excelimportform').hide();">× </button>
          <h4 class="modal-title"><span id="order_mailno">外采购商品导入</span></h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100">导入Excel表： </td>
              <td align="left"><input  type="file" name="file_excel"  value=""/></td>
            </tr>
            <tr>
              <td width="100">excel模板:</td>
              <td align="left"><a href="/fuman/externalbuytemplates/externalbuyimport.xls" target="_blank">外采购商品excel模板</a> &nbsp; </td>
            </tr>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default"
								        data-dismiss="modal" style="display:none"> 关闭 </button>
            <button type="button" class="btn btn-primary" onClick="importExcel(2)" >导入</button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- /.modal --> 
<!-- 更改开发者弹出框--> 
<!-- 模态框（Modal）交运内容 -->
<form action="/externalBuy/updDeveloper" enctype="multipart/form-data" method="post" name="upddeveloperattributeform" id="upddeveloperattributeform" style="font-size: 16px;color: #666;line-height: 21px;font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;">
  <div class="modal fade" id="upddeveloperform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true" style="margin-top: 60px;padding-top:60px;">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true" onClick="javascript:$('#upddeveloperform').hide();">× </button>
          <h4 class="modal-title"><span id="order_mailno">更改维护者</span></h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <!--
								<tr>
									<td width="100">开发者： </td>
									<td align="left">
										<select name="developer" id="developer"  style="width:200px;" required>
											<option value="">-请选择-</option>
											{{foreach from=$userlist item=li key=key}}
												<option value="{{$li.name}}">{{$li.name}}</option>
											{{/foreach}}
										</select>
									</td>
								</tr>
								-->
            <tr>
              <td width="100">维护者： </td>
              <td align="left"><select name="protector" id="protector"  style="width:200px;" required>
                  <option value="">-请选择-</option>
                  
											{{foreach from=$userlist item=li key=key}}
												
                  <option value="{{$li.name}}">{{$li.name}}</option>
                  
											{{/foreach}}
										
                </select></td>
            </tr>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default"
								        data-dismiss="modal" style="display:none"> 关闭 </button>
            <input type="hidden" id="externalId" name="externalId" value="">
            <input type="hidden" name="externalIds" id="externalIds" value="">
            <button type="button" class="btn btn-primary"  onclick="updDeveloper(0,0,0,1)">更新维护者</button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- /.modal --> 
<!-- 推荐商品弹出框--> 
<!-- 模态框（Modal）交运内容 -->
<form action="/externalBuy/doRecommendGoods" enctype="multipart/form-data" method="post" name="dorecommendattributeform" id="dorecommendattributeform" target="_blank" style="font-size: 14px;font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;line-height: 21px;color: #666;">
  <div class="modal" id="dorecommendform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true" style="margin-top: 60px;padding-top:60px;">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true" onClick="javascript:$('#dorecommendform').hide();">× </button>
          <h4 class="modal-title"><span id="order_mailno" style="font-size:18px;">推荐商品信息接收者</span></h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><input type="checkbox" onClick="checkAll();" />
                全选</td>
            </tr>
            <tr>
              <td align="left" width="100"> {{foreach from=$receiverlist item=li key=key}}
                <input type="checkbox" value="{{$li.id}}" name="receiver[]" />
                {{$li.name}}&nbsp;&nbsp;
                {{/foreach}} </td>
            </tr>
            <tr>
              <td style="">推荐说明：{{$receiverlistinstructions}}</td>
            </tr>
             <tr>
              <td style="color:red;font-size:18px;">备注：只能推荐已完成商品</td>
            </tr>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default"
								        data-dismiss="modal" style="display:none"> 关闭 </button>
            <input type="hidden" name="extIds" id="extIds" value="">
            <button type="button" class="btn btn-primary"  onclick="doRecommend(1)">确认推荐</button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- /.modal --> 
<!-- 添加链接弹出框--> 
<!-- 模态框（Modal）交运内容 -->
<form action="/externalbuy/ajaxbutton" enctype="multipart/form-data" method="post" name="dorecommendattributeform" id="dorecommendattributeform" target="_blank" style="font-size: 14px;font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;line-height: 21px;color: #666;">
  <div class="modal" id="dofinishform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true" style="margin-top: 60px;padding-top:60px;">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true" onClick="javascript:$('#dofinishform').hide();">× </button>
          <h4 class="modal-title"><span id="addsure" style="font-size:18px;">添加链接</span></h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left">链接地址：</td>
              <td  align="left"><span>
                <input type='text'  name='linkUrl' id='linkUrl' placeholder='请输入相关链接,如：http://www.baidu.com'/>
                </span></td>
            </tr>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default"
								        data-dismiss="modal" style="display:none"> 关闭 </button>
            <input type="hidden" name="external_id" id="external_id" value="">
            <button type="button" class="btn btn-primary"  onclick="doFinish(0,0,2)">保存</button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- 模态框（Modal） 样本图片-->
<form action="/externalBuy/ajaxbutton?op=saveProductImages"  method="post" name="uctform" id="uctform" >
  <input type="hidden" name="MergeProductID" id="MergeProductID">
  <input type="hidden" value="0" name="uidvalue" id="uidvalue">
  <div class="modal fade" id="showimagesform" tabindex="-1" role="dialog" aria-labelledby="sshowimagesform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"
							        aria-hidden="true">× </button>
          <h4 class="modal-title" id="sshowimagesform">样本图&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="javascript:void(0);" onClick="delone($('#uidvalue').val(),'externalbuy',1)">移除所有图片</a> </h4>
        </div>
        <div class="modal-body">
          <div style="width:100%;height:400px; overflow-y:scroll; border:0px solid;">
            <div id="showimages"></div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><link rel="stylesheet" href="/fuman/upfile/uploadify/zyupload/skins/zyupload-1.0.0.min.css" type="text/css">
                  <script type="text/javascript" src="/fuman/upfile/uploadify/zyupload/zyupload.basic-1.0.0.min.js"></script>
                  <div id="upok"></div>
                  <div id="zyupload" class="zyupload"></div>
                  <div id="uploadInfnew"></div>
                  <script type="text/javascript">
												$(function(){
													// 初始化插件
													$("#zyupload").zyUpload({
														width            :   "650px",                 // 宽度
														height           :   "400px",                 // 宽度
														itemWidth        :   "100px",                 // 文件项的宽度
														itemHeight       :   "95px",                 // 文件项的高度
														url              :   "/fuman/upfile/uploadify/up.php",              // 上传文件的路径
														fileType         :   ["jpg","png","txt","js","exe","JPG","PNG"],// 上传文件的类型
														fileSize         :   51200000,                // 上传文件的大小
														multiple         :   true,                    // 是否可以多个文件上传
														dragDrop         :   false,                   // 是否可以拖动上传文件
														tailor           :   false,                   // 是否可以裁剪图片
														del              :   true,                    // 是否可以删除文件
														finishDel        :   false,  				  // 是否在上传文件完成后删除预览
														/* 外部获得的回调接口 */
														onSelect: function(selectFiles, allFiles){    // 选择文件的回调方法  selectFile:当前选中的文件  allFiles:还没上传的全部文件
															console.info("当前选择了以下文件：");
															console.info(selectFiles);
														},
														onDelete: function(file, files){              // 删除一个文件的回调方法 file:当前删除的文件  files:删除之后的文件
															console.info("当前删除了此文件：");
															console.info(file.name);
														},
														onSuccess: function(file, response){          // 文件上传成功的回调方法
															console.info("此文件上传成功：");
															console.info(file.name);
															console.info("此文件上传到服务器地址：");
															console.info(response);
															//$("#uploadInf").append("<p>上传成功，文件地址是：" + response + "</p>");
															$("#uploadInfnew").append( response );
															$("#upok").html("<p><h1>上传成功，点击提交,保存图片</h1></p>");
														},
														onFailure: function(file, response){          // 文件上传失败的回调方法
															$("#uploadInf").append("<p>此文件上传失败：" + file.name + "</p>");
														},
														onComplete: function(response){           	  // 上传完成的回调方法
															console.info("文件上传完成");
															console.info(response);
														}
													});

												});

											</script></td>
              </tr>
            </table>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default"
								        data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSsubmit('uctform','showimagesform')"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- 模态框（Modal）样本图片 --> 
<!-- /.modal --> 


<!-- 弹出销售报表--> 
<!-- 模态框（Modal） -->
 <form action="#"  method="post" name="qaform" id="qaform"  enctype="multipart/form-data" >
 <input type="hidden" name="demandid_list" id="demandid_list" >
  <div class="modal fade" id="returndataModal" tabindex="-1" role="dialog" aria-labelledby="returnModalLabel" aria-hidden="true" style="margin-top: 60px;padding-top:60px;">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">×
            </button>
            <h4 class="modal-title" id="returnModalLabel">
               销售报表
            </h4>
            <br> 亚马逊分组：美一组：王彦喆;美二组: 吕婷婷;德国：许丰良;日本：梅俊杰;其他：美国<br>
         </div>
         <div class="modal-body">
         
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr >
            <td align="left">
            	<span id="reportShowhtml"></span>
              </td>
          </tr>
        
        </table>
        
         <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal">
               关闭
            </button>
           
         </div>
         </div>
      </div><!-- /.modal-content -->
   </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</form>

<script type="text/javascript">
	function showinput()
	{
		var goodstypeID = $("#goodstypeID").val();
		if(!goodstypeID){
			alert("商品属性不能为空");return false;
		}

		var inputn = document.getElementById("input1");
		var str=inputn.innerHTML;
		var num=1;
		var buyId = $("#buyId").val();
		var sku = $("#skuId").val();
		var attr="";
		//var goodstypeID = $("#goodstypeID").val();

		for(var i=1;i<=num;i++){
			totalnum=totalnum+i;
			str += "<tr class=\"italic\" id=las"+totalnum+">";
			str+="<td>子SKU:</td><td><input type=\"text\" name=\"subsku[]\" style=\"text-transform:uppercase;\" id=\"subsku\" value=\""+sku+"\" class=\"width100\" onblur=\"value=value.replace(/[^A-Za-z0-9-]/ig,'')\" >(如:214880-S)</td>";
			if(goodstypeID)
			{
				$.ajaxSetup({async: false});	//同步
				$.post("/product/ajaxbutton", {"op": "showattr","id":goodstypeID},function(data){
					if(data !=201)
					{
						for(var s=0;s<data.length;s++)
						{
							attr+="<td style='width:36px;'>"+data[s].attr_name+"</td>";
							if(data[s].attr_input_type==0)
							{
								attr+="<td style='padding:0;margin:0;'><input type=\"text\" name=attr_values"+data[s].attr_id+"[] id=attr_values"+data[s].attr_id+" class=\"width50\"></td>";
							}else{
								var words = data[s].attr_values.split('\r\n');
								if(data[s].attr_values_code){
									var wordscode= data[s].attr_values_code.split('\r\n');
								}else{
									var wordscode="";
								}
								var tmpwords="<select name=attr_values"+data[s].attr_id+"[] id=attr_values"+data[s].attr_id+" class=\"selection\" style=\"width:50px;\" onchange=\"getcode(this,"+totalnum+")\">";
								tmpwords+='<option value="" code="99999999AA">请选择</option>';
								for(var k=0;k<words.length;k++)
								{
									if(wordscode=='')
									{
										tmpwords+=" <option value=\""+words[k]+"\" code='99999999AA'>"+words[k]+"</option>";
									}else{
										tmpwords+=" <option value=\""+words[k]+"\" code=\""+wordscode[k]+"\">"+words[k]+"</option>";
									}

								}
								tmpwords+=" </select>";
								attr+="<td>"+tmpwords+"</td>";
							}

						}
					}
				},"json");
			}

			str+=attr;
			str+="<td style='width:30px;'>备注:</td><td><input type=\"text\" name=\"subskuinfo[]\" id=\"subskuinfo\"  class=\"width200\" placeholder='如:长20CM宽10CM'></td>";
			str+="<td><input type=\"file\" name=\"userfile[]\" id=\"userfile\"  class=\"width100\"></td>";
			str+="<td style='width:30px;'><a href=javascript:void(0) onclick=delfileinput("+totalnum+")><span style=\"padding:5px 0 0;\" class=\"c9\">移除</span></a></td>";
			str+="</tr>";
		}
		$("#input1").before(str);
		/**
		var inputn = document.getElementById("input1");
		var str=inputn.innerHTML;
		var num=1;
		var buyId = $("#buyId").val();
		var sku = $("#skuId").val();
		for(var i=1;i<=num;i++){
			totalnum=totalnum+i;
			str += "<tr class=\"italic\" id=las"+totalnum+">";
			str+="<td style='text-align:right;'>子SKU:</td>";
			str+="<td><input type=\"text\" name=\"subsku[]\" style=\"text-transform:uppercase;\" id=\"subsku\" value=\""+sku+"\" class=\"width100\" placeholder='SKU 如：214880-S'>(如：214880-S)</td>";
			str+="<td><input type=\"text\" name=\"subskuinfo[]\" id=\"subskuinfo\"  class=\"width200\" placeholder='尺码备注：如 长20CM宽10CM'></td>";
			str+="<td><input type=\"file\" name=\"userfile[]\" id=\"userfile\"  class=\"width200\"></td>";
			str+="<td>&nbsp;&nbsp;<a href=javascript:void(0) onclick=delfileinput("+totalnum+")><span style=\"padding:5px 0 0\" class=\"c9\">移除</span></a></td>";
			str+="</tr>";
		}
		$("#input1").before(str);
		 **/

	}
	function updDeveloper(id,developer,protector,upd) {
		var str = selectallpro();
		if(str !=false)
		{
			if(developer){
				/**
				 $("#externalId").val(id);
				 $("#developer").val(developer);
				 $("#protector").val(protector);
				 **/
				$("#externalIds").val(str);
				$('#upddeveloperform').modal('show');
			}
			if(upd){
				$("#upddeveloperattributeform").submit();
				$("#upddeveloperform").hide();
				//location.reload();
			}
		}


	}
	//推荐商品
	function doRecommend(flag) {
		var str = selectallpro();
		if(str !=false)
		{
			if(flag==0){
				$("#extIds").val(str);
				$('#dorecommendform').show();
			}
			if(flag==1){
				var vote_arr = document.getElementsByName("receiver[]");
				var idarr = new Array();
				var i=0;
				var strs="";
				for(var j = 0; j < vote_arr.length; j++){
					if(vote_arr[j].checked == true){
						idarr[i] = vote_arr[j].value;
						strs += vote_arr[j].value+",";
						i++;
					}
				}
				if(i<=0){
					alert("未选中相关推荐者");
					return false;
				}
				$.post("/externalBuy/ajaxbutton", {"op": "doRecommendGoods","ids":str,"receiver":strs},
						function(data){
							if(data)
							{
								alert("推荐成功!");
								window.location.reload();
							}
						},"text");


			}

		}
	}
	function checkAll() {
		var arr_receiver = document.getElementsByName("receiver[]");
		for(var i = 0; i < arr_receiver.length; i++){
			if(arr_receiver[i].checked == true){
				arr_receiver[i].checked = false;
			}else{
				arr_receiver[i].checked = true;
			}
		}
	}
	//转正开发
	function reverseDeveloper(sku) {
		//需要判断该商品是否已经卖满三件
		if(confirm("确定转正开发？")){
			$.post("/externalBuy/ajaxbutton", {"op": "getGoodsSalesCount","sku":sku},
					function(data){
						if(data.code==1)
						{
							window.open("/product/addNewprodct?sku="+sku,"_blank");
						}else{
							alert("该商品销售数量【"+data.saleNum+"】没有达到指定销售数量【"+data.nums+"】，不能进行新品开发!");return false;
						}
					},"json");
		}
	}
	
	function showreport(sku)
	{
		$.post("/externalBuy/ajaxbutton", {"op": "showreport","sku":sku},
			function(data){
				if(data == 201)
				{
					alert("暂无销售数据!");return false;	
				}else{
					$("#reportShowhtml").html(data);
					$('#returndataModal').modal('show');
				}
				
				alert(tmp);
			},"text");
	}
</script>
<div id="goToTop" style="display:none"><a href="javascript:;">TOP</a></div>
</body>
</html>